
/*信息详情*/
Ext.define('qjtravel.view.MoreDetail', {
    extend: 'Ext.Container',
    xtype: 'moreDetail',

    requires:[
        'Ext.data.Store',
        'Ext.field.Search',
        "Ext.dataview.List"
    ],
    config:{
        layout: 'vbox',
        items: [
            {
                xtype:'titlebar',
                docked:'top',
                id:'titlebar',
                items:[
                    {
                        xtype:'button',
                        text:'返回',
                        handler:function(){
                            Ext.Viewport.remove(this.up('moreDetail'),true);
                            //this.up('moreDetail').destroy()
                        }
                    }
                ]
            },
            {
                xtype:'panel',
                cls:'content',
                flex:5,
                scrollable:true,
                listeners: {
                initialize: function () {
                    Ext.Viewport.mask({xtype: 'loadmask' });
                    Ext.Ajax.request({
                        url: Global.api_url + '/cloud/1/article_info_get',
                        params: {caid: window.localStorage.getItem('MoreDetail_caid')},
                        scope: this,
                        success: function (response) {
                            Ext.Viewport.unmask();
                            var result = Ext.decode(response.responseText);
                            data = result.Variables.data;
                            var length=data.photos.length;
                            var image='';
                            //添加图片
                            for(var i= 0;i<length;i++){
                                image+='<img src='+data.photos[i].url+' width="80%"  style="margin:0 10%" />'
                            }
                            Ext.getCmp('titlebar').setTitle(data.name);
                            //加载咨询详细内容
                            this.setHtml(
                                '<div style="padding: 10px 10px">' +
                                    image+
                                    '<div>' + data.content + '</div>' +
                                    '</div>'
                            )
                        },
                        failure: function () {
                            Ext.Viewport.unmask();
                            cordova.exec(function (message) {
                            }, function (error) {
                            }, "Messages", "showMsg", ['请求失败', '服务器维护中....']);
                            return false;
                        }
                    })
                }
            }
            }
        ],listeners: {
            back:function() {
                Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
            }
        }
    }
});

